﻿using BCL.BaseLib;
using BCL.BaseLib.Basics;
using System;
using System.Collections.Generic;
using System.Windows.Controls;

namespace BCL.WPFComponent
{
    /// <summary>
    /// Datagrid.xaml 的交互逻辑
    /// </summary>
    public partial class Datagrid : Base.BaseFunctionControl
    {
        public Datagrid()
        {
            InitializeComponent();
            this.datagrid1.DataContext = new List<dynamic>() { new { Name = "123", Age = "123" }, new { Name = "123", Age = "123" }, new { Name = "123", Age = "123" }, new { Name = "123", Age = "123" }, new { Name = "123", Age = "123" }, new { Name = "123", Age = "123" } };
        }
        public Datagrid(FunctionEntity fe) : base(fe)
        {
            InitializeComponent();
            this.datagrid1.DataContext = new List<dynamic>() { new { Name = "123", Age = "123" }, new { Name = "123", Age = "123" }, new { Name = "123", Age = "123" }, new { Name = "123", Age = "123" }, new { Name = "123", Age = "123" }, new { Name = "123", Age = "123" } };
        }

        public override void LanguageBinding()
        {

        }

        private void BaseFunctionControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {

            comboboxLang.ItemsSource = BCL.Tool.LanguagePackage.GetLanguagePackages();
            comboboxLang.DisplayMemberPath = "Value";
            comboboxLang.SelectionChanged += ComboboxLang_SelectionChanged;
        }

        private void ComboboxLang_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Tool.LanguageKeyValue languageKeyValue = comboboxLang.SelectedItem as Tool.LanguageKeyValue;
            Tool.LanguagePackage.SetLanguage(languageKeyValue);
        }
    }
}
